Skip to content

Make IJSONServerSpec the settings shape and allow an undefined Authorization header - #367

Closed
isc-klu wants to merge 2 commits into
intersystems-community:masterfrom
isc-klu:merge-jsonspec-and-setting-and-permit-undefined-headers
Closed

isc-klu wants to merge 2 commits into
intersystems-community:masterfrom
isc-klu:merge-jsonspec-and-setting-and-permit-undefined-headers

Conversation

@isc-klu

@isc-klu isc-klu commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Before OAuth2 support (#335), IJSONServerSpec described one entry of the intersystems.servers setting, and IServerSpec was the only server type exchanged between Server Manager and other extensions. That PR added a private IServerSetting type to hold new OAuth2 fields, put the runtime auth object on IJSONServerSpec, and added a public IServerSpecWithAuth as the return type of getServerSpec, so that neither type kept its original role. This PR merges IServerSetting into IJSONServerSpec and IServerSpecWithAuth into IServerSpec, restoring the two original types to their long-standing roles.

In addition, ResolvedAuthorization.httpAuthorizationHeader may now be undefined. #366 treats basic authorization with an explicit UnknownUser as resolved, and such an auth has no header to send. accessToken stays a string, empty for UnknownUser, because vscode.AuthenticationSession.accessToken is typed string.

…tion header

Types package 3.15.0-beta.1:
- IJSONServerSpec describes one intersystems.servers entry: gains oauth2, loses auth
- IServerSpec adds name and auth, deprecates username/password, omits oauth2
- Remove IServerSpecWithAuth; getServerSpec returns IServerSpec
- ResolvedAuthorization.httpAuthorizationHeader may be undefined (UnknownUser);
  accessToken stays a string, empty for UnknownUser

Extension:
- Replace internal IServerSetting/OAuth2Config with the public types
- OAuth2Authorization narrows to ResolvedOAuth2Authorization for its header
- Depend on the published 3.15.0-beta.1
@isc-klu isc-klu changed the title Clean architecture on types level and prepare for the support of UnknownUser Make IJSONServerSpec the settings shape and allow an undefined Authorization header Oct 14, 2026
@isc-klu
isc-klu marked this pull request as ready for review October 14, 2026 15:54
@isc-klu
isc-klu requested review from gjsjohnmurray and isc-bsaviano and removed request for isc-bsaviano October 14, 2026 15:57
@gjsjohnmurray

gjsjohnmurray commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

@isc-klu will an extension that uses @intersystems-community/intersystems-servermanager version 3.14.1 continue to be able to use the public API of the Server Manager extension even after we publish Server Manager 3.15.0 on Marketplace?

@isc-klu

isc-klu commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@gjsjohnmurray Let me know if I have misread the question. I take it as: can a client extension built against the 3.14.1 types keep working against a 3.15.0 implementation?

If 3.15.0 contained only this PR, yes. The changes here are type reshaping and internal cleanup, so runtime behaviour toward clients is unchanged.

I intend 3.15.0 to also include #366, which does affect clients. It makes "UnknownUser" a valid username meaning unauthenticated access. For such an auth, accessToken is "", credentials is {}, and httpAuthorizationHeader is undefined. The undefined is the deliberate part: axios drops undefined headers but sends empty-string ones, so a client that assigns the header directly works without changes. A client that assumes the header is always a string, for example by interpolating it, will break.

@isc-bsaviano

Copy link
Copy Markdown
Collaborator

Are you sure this change is needed? Couldn't client extensions see that username is UnknownUser and then proceed without asking server manager to resolve auth at all?

@isc-klu

isc-klu commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

Not strictly. If we accept that new BasicAuthorization("UnknownUser").resolved() returns false, this change can go. The cost is that resolved() stops being the one check a client needs before asking Server Manager for credentials: every client would also have to special-case username === "UnknownUser" first, and one that forgets would trigger a credential prompt for a server that needs none. Widening the header type keeps that knowledge in Server Manager instead of in each client.

@isc-bsaviano

Copy link
Copy Markdown
Collaborator

It might be better to return an empty string for the header and then update the main extension to set its header a different way. We need to update that anyways as part of this work. Then we don't have to publish a new types version.

@isc-klu

isc-klu commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator Author

@isc-bsaviano Keeping the types package unchanged sounds good to me. httpAuthorizationHeader stays a string on a resolved authorization and is "" for UnknownUser, and an UnknownUser authorization counts as resolved. If you agree, please thumb up this comment and I'll close the PR.

@isc-klu isc-klu mentioned this pull request Oct 14, 2026
isc-klu added a commit to isc-klu/intersystems-servermanager that referenced this pull request Oct 14, 2026
Per review on intersystems-community#367 the types package stays unchanged, so ResolvedAuthorization.httpAuthorizationHeader
remains a string and BasicAuthorization returns "" for UnknownUser. Clients must skip an empty header.
IServerSetting is restored internally, based on IJSONServerSpec so it carries no name.
@isc-klu isc-klu closed this Oct 15, 2026
@isc-klu
isc-klu deleted the merge-jsonspec-and-setting-and-permit-undefined-headers branch October 23, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants